<template>
  <div>商家店铺</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import axios from 'axios'
import { useRoute } from 'vue-router'
const route = useRoute()
console.log(route.query.out_trade_no)
const queryAllOrders = async () => {
  if(!route.query.method) return;
  const res=await axios.post('/app/add',route.query)
  console.log(res);
  if(res.data.code==200){
      var resq=await axios.put('/app/update',{
        out_trade_no:route.query.out_trade_no,
      })
      console.log(resq);
      if(resq.data.code==200){
         window.location.href='/queryOrder'
      }

  const res = await axios.get('/app/query', {
    params: {
      trade_no: route.query.trade_no,
    },
  })
}
  console.log(res.data.data.alipay_trade_query_response)
  const resp = await axios.post('/app/add', res.data.data.alipay_trade_query_response)
  console.log(resp)
  if (resp.data.code === 200) {
    localStorage.setItem('isorderfalse', 'true')
  } else {
    localStorage.setItem('isorderfalse', 'false')
  }
}
queryAllOrders()

</script>
